#ifndef RDSQL_H
#define RDSQL_H

typedef unsigned char RedDogGameID[8];

class RedDogSavedGame;

//
// All money values are in cents (100 == $1, 25 == $.25, 1 == $.01)
//
// IMPORTANT:  Access to this class is NOT thread-safe.  That's handled at
//			   the next level up (with calls to lock()/unlock()).
//

typedef char PID[8 + 1];

class RedDogSQL 
{
	public:
		RedDogSQL(char* DBHost, char* DBName, char* DBPassword);

		bool8 createGame(PID, bool8 forMoney, RedDogGameID,
			int32 bet, int32* balance);

		bool8 deal(PID, RedDogGameID, int32 numPlayer, uint8* player);

		bool8 gameDone(PID, bool8 forMoney, RedDogGameID, int32 outcome,
			int32 balanceAdjust, int32* balance);

		bool8 hasSavedGame(PID, bool8 forMoney, RedDogGameID, RedDogSavedGame*);
		bool8 removeSavedGame(PID, bool8 forMoney);
		bool8 saveGame(PID, bool8 forMoney, RedDogGameID, RedDogSavedGame*);

	protected:
		void outcomeToDB(uint8, char*);
		void DBtoRedDogGameID(const char *, RedDogGameID);
		void RedDogGameIDtoDB(RedDogGameID, char*);
};

#endif
